package lab01;

import java.util.Random;
import java.util.Scanner;

public class Test8 {
    public static void main(String[] args) {
        int i=new Random().nextInt(101);
        System.out.println(i);
        System.out.println("请输入你的数:");
        int n=new Scanner(System.in).nextInt();
        new Test8().compare(i,n);
    }
    public void compare(int i,int n){
        if (i>n){
            System.out.println("小了");
            n=new Scanner(System.in).nextInt();
            compare(i,n);
        }else if (i<n){
            System.out.println("大了");
            n=new Scanner(System.in).nextInt();
            compare(i,n);
        }else {
            System.out.println("猜对了");
            return;
        }
    }
}
